package com.bootdo.system.service.impl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bootdo.system.domain.TbMtlm;
import com.bootdo.system.domain.TbMtlmExample;
import com.bootdo.system.domain.TbMtlmExample.Criteria;
import com.bootdo.system.mapper.TbMtlmMapper;
import com.bootdo.system.service.MtlmService;

@Service
public class MtlmServiceImpl implements MtlmService{

	@Autowired
    private TbMtlmMapper om;
	@Override
	public List<TbMtlm> getList(String status) {
		TbMtlmExample tbMtlmExample = new TbMtlmExample();
		Criteria createCriteria = tbMtlmExample.createCriteria();
		if(StringUtils.isNoneBlank(status)) {
			createCriteria.andStatusEqualTo(status);
			return om.selectByExample(tbMtlmExample);
		}
		return null;
	}

	@Override
	public int insert2update(TbMtlm table) {
		int res=0;
		if(table != null) {
			Integer id = table.getId();
			if(id != null) {
				res=om.updateByPrimaryKeySelective(table);
			}else {
				res=om.insertSelective(table);
			}
		}
		return res;
	}

	@Override
	public int del(Integer id) {
		return om.deleteByPrimaryKey(id);
	}

	@Override
	public List<TbMtlm> getList2(String orderId) {
		TbMtlmExample tbMtlmExample = new TbMtlmExample();
		Criteria createCriteria = tbMtlmExample.createCriteria();
		if(StringUtils.isNoneBlank(orderId)) {
			createCriteria.andOrderidEqualTo(orderId);
			return om.selectByExample(tbMtlmExample);
		}
		return null;
	}

	@Override
	public List<TbMtlm> getList3() {
		TbMtlmExample tbMtlmExample = new TbMtlmExample();
		Criteria createCriteria = tbMtlmExample.createCriteria();
		return om.selectByExample(tbMtlmExample);
	}
	
	

}
